﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using CreatureSoft.Hoot.Domain.DocumentManagent;
using CreatureSoft.Hoot.Data.Mapping;

namespace CreatureSoft.Hoot.Data
{
    public class HootDataContext : DbContext
    {
        //public DbSet<Folder> Folders { get; set; }

        static HootDataContext() 
        {
            //Database.SetInitializer<HootDataContext>();
            //Database.SetInitializer<HootDataContext>(new DropCreateDatabaseAlways<HootDataContext>());               
        }

        public HootDataContext(): base()
        {
            this.Configuration.LazyLoadingEnabled = true;
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new FolderMap());
            modelBuilder.Configurations.Add(new UserMap());
        }

        public virtual void Commit()
        {
            base.SaveChanges();
        }
    }
}
